package com.xbn.netty.nettyByteBuf;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.util.CharsetUtil;

/**
 * @author XBN
 * @date 2020/10/21 14:14
 * @email 78742541@qq.com
 */
public class NettyByteBuf2 {
    public static void main(String[] args) {
        ByteBuf byteBuf = Unpooled.copiedBuffer("这是一段字符", CharsetUtil.UTF_8);
       if(byteBuf.hasArray())
       {
           byte[] content = byteBuf.array();
           System.out.println(new String(content,CharsetUtil.UTF_8));
       }

    }
}
